﻿@model IList<COMCMS.Core.AdsKind>
@{
    ViewBag.title = "广告分类管理";
}
<div class="wrapper wrapper-content ">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>@ViewBag.title</h5>
        </div>
        <div class="ibox-content">
            <div id="toolbar" class="btn-group">
                <button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showAddRow();">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
                </button>
            </div>

            <div id="toolbar2" class="btn-group pull-right">
                <button id="btn_refresh" type="button" class="btn btn-outline btn-default" onclick="refresh();">
                    <span class="fa fa-refresh" aria-hidden="true"></span>刷新
                </button>
            </div>
            <form name="listAdsCategoryForm" id="listAdsCategoryForm" method="post" onsubmit="return false">
                <table class="tree table table-striped table-bordered">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>类别名称</th>
                            <th class="text-center">排序</th>
                            <th>简单说明</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    @if (Model.Count == 0)
                    {
                        <tr><td colspan="5" class="text-center">暂无记录</td></tr>
                    }
                    @foreach (var m in Model)
                    {
                        <tr id="row_@m.Id">
                            <td>
                                <div class="rt-editpanel">@m.Id</div>
                                <div class="rt-savepanel hidden">
                                    @m.Id
                                    <input type="hidden" name="Id" id="Id_@m.Id" value="@m.Id" class="rt-edit" />
                                </div>
                            </td>
                            <td>
                                <div class="rt-editpanel">@m.KindName</div>
                                <div class="rt-savepanel hidden">
                                    <input name="KindName" id="KindName_@m.Id" type="text" class="form-control rt-edit" placeholder="请输入类别名称" maxlength="100" value="@m.KindName" />
                                </div>
                            </td>
                            <td class="text-center">
                                <div class="rt-editpanel">@m.Rank</div>
                                <div class="rt-savepanel hidden">
                                    <input type="number" name="Rank" id="Rank_@m.Id" class="form-control rt-edit" value="@m.Rank" maxlength="3" placeholder="请输入类别排序，只能填写数字" />
                                </div>
                            </td>
                            <td>
                                <div class="rt-editpanel">@m.KindInfo</div>
                                <div class="rt-savepanel hidden">
                                    <input type="text" name="KindInfo" id="KindInfo_@m.Id" class="form-control rt-edit" value="@m.KindInfo" placeholder="类别简介，非必填" maxlength="200" />
                                </div>
                            </td>
                            <td>
                                <div class="rt-editpanel">
                                    <a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="showEdit(@m.Id)"><i class="fa fa-edit"></i> 编辑</a>
                                    <a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Other/DelAdsKind',@m.Id);"><i class="fa fa-close"></i> 删除</a>
                                </div>
                                <div class="rt-savepanel hidden">
                                    <a href="javascript:;" class="btn btn-xs btn-success" title="保存" onclick="doEdit('listAdsCategoryForm', '/AdminCP/Other/EditAdsKind',@m.Id)"><i class="fa fa-save"></i> 保存</a>
                                    <a href="javascript:;" class="btn btn-xs btn-default" title="取消" onclick="cancelEdit(@m.Id);"><i class="fa fa-mail-reply"></i> 取消</a>
                                </div>
                            </td>
                        </tr>
                    }
                    <tr id="addnew" class="hidden">
                        <td>
                            <span class="text-primary">新增</span>
                        </td>
                        <td><input name="KindName" id="KindName" type="text" class="form-control addnew" placeholder="请输入类别名称" required maxlength="100" /></td>
                        <td class="text-center"><input type="number" name="Rank" id="Rank" class="form-control addnew" value="0" maxlength="3" placeholder="请输入类别排序，只能填写数字" /></td>
                        <td><input type="text" name="KindInfo" id="KindInfo" class="form-control addnew" placeholder="类别简介，非必填" maxlength="200" /></td>
                        <td>
                            <button type="button" class="btn btn-xs btn-success" title="保存" onclick="doAdd('listAdsCategoryForm', '/AdminCP/Other/AddAdsKind');"><i class="fa fa-save"></i> 保存</button>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>


</div>

